<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        //任务是一个一个执行的，不是同时执行的
        let i=0
        setTimeout(()=>{
            ++i
            console.log(i) //1
        },1000)
        setTimeout(()=>{
            ++i
            console.log(i) //2
        },1000)

        console.log(i) //0
    </script>
</body>
</html>